package com.ktjiaoyu.springsecuritydemo.controller;

import org.springframework.security.access.annotation.Secured;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class LoginController {

    @RequestMapping("/tologin")
    public String toLogin(){
        return "login";
    }

    /*@RequestMapping("/doLogin")
    public String login(){
        System.out.println("登录。。。。。。。。。。");
        return "main";
    }*/

    @RequestMapping("/toMain")
//    @Secured("admin")
//    @PreAuthorize("hasAuthority('admin123')")
//    @PreAuthorize("hasRole('abcd')")
    public String toMain(){
        return "main";
    }

//    @RequestMapping("/toError")
//    public String toError(){
//        return "error";
//    }
    @RequestMapping("/toMain1")
    public String toMain1(){
        return "main1";
    }

    @RequestMapping("/demo")
    public String demo(){
        return "demo";
    }

}
